package AtmSystem;

import java.util.*;

public class Client extends Person
{   
	private int userID;
	private String username;
	private String password;
	private String email;	
	private BankAccountDB myBankAccountDB;
	private BankAccount currentBankAccount;

	public Client(int initialUserID, String initialUsername,String initialPassword,String initialEmail)
	{
        super(initialUserID,initialUsername, initialPassword,initialEmail);
		myBankAccountDB = new BankAccountDB();
	}

	 public BankAccountDB getBankAccountDB()
	 {
		 return myBankAccountDB;
	 }

	 public BankAccount getCurrentBankAccount()
	{
		 return currentBankAccount;
	 }

	 public void setCurrentBankAccount(int newCardNumber)
	{
		 currentBankAccount = getBankAccountDB().isExsit(newCardNumber);
	 }

	
	
	public BankAccount addBankAccount(int newCardNumber,double newBalance)
	{
		if(newBalance >= 0)
		{
			BankAccount myBankAccount = new BankAccount(newCardNumber,newBalance);
		myBankAccountDB.add(myBankAccount);
        return myBankAccount;
		}
		else 
		return null;
	}

	public boolean removeBankAccount(int newCardNumber)
		{
      return myBankAccountDB.removeb(newCardNumber);
		}

		public boolean equals(Client newClient)
	{
			if ( getUserID()== newClient.getUserID()  )
			{
				return true;
			}
			else return false;
		}


}


